import { request } from '@/api/service'

export const urlProPrefix = '/ai/projects/'
export const urlModelPrefix = '/ai/models/'

export function Stop (typeParams, opArr) {
  return request({
    url: '/datasource/stop/',
    method: 'get',
    params: { params: typeParams, op: opArr }
  })
}

export function GetPredict (modelID) {
  return request({
    url: urlModelPrefix + 'predict/',
    method: 'get',
    params: { id: modelID }
  })
}

export function GetProList (query) {
  return request({
    url: urlProPrefix,
    method: 'get',
    params: { ...query }
  })
}

export function GetModelList (query) {
  return request({
    url: urlModelPrefix,
    method: 'get',
    params: { query }
  })
}

export function GetModelObj (id) {
  return request({
    url: urlModelPrefix + id + '/',
    method: 'get',
    data: { id }
  })
}

export function Upload (url, modelID) {
  return request({
    url: urlModelPrefix + 'move/',
    method: 'post',
    data: { url, id: modelID }
  })
}
